<%-- 
    Document   : RegisterForm
    Created on : Nov 16, 2013, 11:05:20 PM
    Author     : smarzoug
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>RegisterForm.jsp</title>
        <link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900" rel="stylesheet" />
        <link href="default.css" rel="stylesheet" type="text/css" media="all" />
        <link href="fonts.css" rel="stylesheet" type="text/css" media="all" />
        <script language="javascript">
        function validate()
        {
           var temp = document.register;



          hell();
           var v1 = temp.loginname.value;
           if(v1.charAt(0)>='0'&& v1.charAt(0)<='9')
           {
              alert("La première lettre du nom d'utilisateur doit être alphabetique.");
              return false;
           }
           if(temp.fname.value=="" || temp.lname.value=="" || temp.bdate.value=="" || temp.loginname.value=="" || temp.password.value=="" || temp.sanswer.value=="")
           {
               alert("Tous les champs sont obligatoires");
               return false;
           }
           if(temp.ch.checked && temp.ownquest.value=="")
           {
               alert("Tous les champs sont obligatoires");
               return false;
           }
           return true;
        }
        function check()
        {
            var form = document.register;
            if(!form.ch.checked){
                  form.ownquest.disabled=true;
                  form.squest.disabled=false;
            }
            else{
                  form.ownquest.disabled=false;
                  form.squest.disabled=true;
            }
        }
         function hello()
         {
                var temp = document.register;


                for(int i=0;i<temp.fname.value.length();i++)
                {
                      if(v.charAt(i)>='0' && v.charAt(i)<='9')
                      {
                          alert("Le nom doit être uniquement alphabétique");
                          return false;     
                      }
                }
        }

        </script>
        
        <script type="text/javascript" src="scripts/general.js"> </script>
        <script language="javascript" src="scripts/ts_picker.js"></script>
    </head>
    <body>
        <div id="header-wrapper">
            <div id="header" class="container">
                    <div id="logo">
                            <span class="icon icon-fire"></span>
                            <h1><a href="#">Edu-Fac</a></h1>
                    </div>
                    <div id="menu">
                            <ul>
                                    <li class="current_page_item"><a href="index.jsp" accesskey="1" title="">Accueil</a></li>
                                    <li><a href="#" accesskey="5" title="">Contacts</a></li>
                            </ul>
                    </div>
            </div>
        </div>
        
        <div id="wrapper2">
            <div id="newsletter" class="container">
                <div class="content">
                    <form action="RegisterAction.jsp" method="post" name="register" onSubmit="return validate()">
                        <legend><strong>INSCRIPTION</strong></legend>
                        <p>&nbsp;</p>
                        <p align="center" class="style2">
                            <%if(request.getParameter("status")!=null){%>
                            <%=request.getParameter("status")%>
                            <%} %>
                        </p>
                        <table border="0" align="center">
                            <tr>
                                <td><input type="text" class="text"  name="fname" onclick="hello()" placeholder="Prénom"/></td>
                            </tr>
                            <tr>
                                <td><input type="text" class="text" name="lname" placeholder="Nom"/></td>
                            </tr>
                            <tr>
                                <td><input type="text" name="bdate" readonly class="text" placeholder="Date de naissance"/>
                                    <a href="javascript:show_calendar('document.register.bdate', document.register.bdate.value);"> 
                                        <img src="images/cal.gif" alt="c" width="18" height="18" border="0"/>
                                    </a>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <select name="city" class="text">
                                        <option>Paris</option>
                                        <option>Lyon</option>
                                        <option>Marseille</option>
                                        <option>Lille</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <select name="state" class="text">
                                        <option>Ile-de-France</option>
                                        <option>Rhône-Alpes</option>
                                        <option>Nord</option>
                                        <option>Provence-Alpes Côte d'Azur</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <select name="country" class="text">
                                        <option>France</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td><input type="text" name="loginname" class="text" placeholder="Nom d'utilisateur"/></td>
                            </tr>
                            <tr>
                                <td><input name="password" type="password" id="password" class="text" placeholder="Mot de passe"/></td>
                            </tr>
                            <tr>
                                <td>
                                    <SELECT name="squest">
                                            <OPTION value="1"> Passe-temps favori? </OPTION>
                                            <OPTION value="2"> Personnage préféré? </OPTION>
                                            <OPTION value="3"> Nom de votre 1ère école? </OPTION>
                                            <OPTION value="4"> Lieu de naissance de votre épouse? </OPTION>
                                            <OPTION value="5"> Sport favori? </OPTION>
                                            <OPTION value="6"> Deuxième prénom de ton père? </OPTION>
                                            <OPTION value="7"> Nom de la mascotte de l'école? </OPTION>
                                            <OPTION value="8"> Modèle de votre premier véhicule? </OPTION>
                                            <OPTION value="9"> Nom de votre animal de compagnie? </OPTION>
                                        </SELECT>
                                </td>
                            </tr>
                            <tr>
                                <td>Question personnalisée ?
                                    <INPUT type="checkbox" class="text" name="ch" value="1" onClick="check(register)">
                                </td>
                            </tr>
                            <tr>
                                <TD><INPUT type="text" class="text" name="ownquest" placeholder="Question personnalisée" disabled></TD>
                            </tr>
                            <tr>
                                <TD><INPUT name="sanswer" type="text" class="text" placeholder="Réponse secrète"></TD>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <div align="center">
                                        <input class="button submit" name="Input" type="submit" value="S'inscrire" onclick="hello"/>
                                        &nbsp;
                                        <INPUT class="button submit" name="Input" type="reset" value="Réinitialiser">
                                        <br><a class="button submit" href="index.jsp">Page d'accueil</a>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
        </div>
        
        <div id="copyright">
            <p>Copyright (c) 2013 Sofyen MARZOUGUI - ECE Paris - All rights reserved.</p>
        </div>  
    </body>
</html>
